<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1"/>
    <meta charset="utf-8"/>
    <title>米塔云平台管理系统</title>
    <link href="../plugins/selectivity/selectivity-jquery.css" rel="stylesheet">
    <link href="../plugins/bootstrap/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugins/bootstrapValidator/bootstrapValidator.min.css" rel="stylesheet"/>
    <link href="../plugins/font-awesome/css/all.min.css" rel="stylesheet"/>
    <link href="../customize/css/iconfont.css" rel="stylesheet">
    <link href="../customize/css/content.css" rel="stylesheet"/>
    <style>
        td img {
            width: 80px;
            height: 80px;
        }

        .col-2 {
            margin-bottom: 1rem;
        }

        .qr-code-content {
            top: 18px;
            left: 50%;
            margin-left: -18px;
            width: 100px;
            height: 100px;
            display: none;
        }

        .has-feedback label ~ .form-control-feedback {
            top: 37px;
            right: 10px;
        }
    </style>
</head>
<body>
<div class="m-3">
    <div class="custom-section">
        <nav class="mb-3">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><i class="iconfont icon-xiaolan6"></i> 设备管理</li>
                <li class="breadcrumb-item active"><i class="iconfont icon-xiaolan7"></i> 生产设备管理</li>
            </ol>
        </nav>
        <div class="d-flex align-items-center justify-content-between mb-3">
            <div class="form-row align-items-center" shiro:hasAnyPermission="device:sensor:view,device:sensor:opera">
                <div class="col-auto">
                    <strong class="font-p14">快捷查询：</strong>
                </div>
                <div class="col-auto">
                    <input type="text" class="form-control" id="param-id" placeholder="快捷查询">
                </div>
                <div class="col-auto">
                    <div class="selectivity-input form-control" id="search_company" style="min-width: 210px;"></div>
                </div>
                <div class="col-auto">
                    <select class="form-control" id="bind">
                        <option value="0">采集设备是否绑定-全部</option>
                        <option value="1">已绑定</option>
                        <option value="2">未绑定</option>
                    </select>
                </div>
                <div class="col-auto">
                    <button class="btn btn-primary" type="button" onclick="loadPrdEquManagementList()"><i
                            class="iconfont icon-dituyechaxun"></i></button>
                </div>
            </div>
            <div>
                <button shiro:hasPermission="device:proc:opera" class="btn btn-primary" type="button"
                        onclick="addInfo()"><i class="fa fa-plus"></i> 添加生产设备
                </button>
            </div>
        </div>
        <table class="table table-striped table-bordered table-center" id="PEM-List"></table>
        <div id="page" class="page_div"></div>
    </div>
</div>
<!-- Modal -->
<div shiro:hasPermission="device:proc:opera" class="modal fade" id="addInfoModal" data-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <form class="modal-content text-body" id="addInfoForm">
            <div class="modal-header">
                <div class="modal-title"><i class="iconfont icon-juxing"></i><span id="modal_title">添加生产设备</span></div>
                <button type="button" class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="text-secondary font-p12 mb-2">注：带<span class="form-required">*</span><span
                        class="ml-3"></span>标识的为必填项
                </div>
                <div class="modal-sub-title d-flex align-items-center mb-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>基本信息</span>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="form-group col-4">
                            <label for="validationCustom01">设备名称<span class="form-required">*</span></label>
                            <input type="hidden" name="methodType" id="type-id" value="0">
                            <input type="hidden" name="id" id="d-id">
                            <input class="form-control" type="text" name="name" id="validationCustom01">
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom02">设备编号<span class="form-required">*</span></label>
                            <input class="form-control" type="text" name="sn" id="validationCustom02">
                        </div>
                        <div class="form-group col-4">
                            <label for="company-list">归属企业<span class="form-required">*</span></label>
                            <div class="selectivity-input form-control" id="company-list"
                                 onchange="loadGroupTwo($(this).selectivity('val'))"></div>
                            <input class="form-control position-absolute" type="text" name="enterpise"
                                   id="company-list-vld" style="opacity: 0">
                        </div>
                        <input type="hidden" name="deviceType" id="device_type">
                        <div class="form-group col-12">
                            <label for="device-type">设备类型<span class="form-required">*</span></label>
                            <div class="row">
                                <div class="col-4">
                                    <select class="form-control device-type" name="typeOne" id="device-type"
                                            onchange="loadDeviceType(this,$('#device-type-child'))">
                                        <option value>请选择</option>
                                    </select>
                                </div>
                                <div class="col-4">
                                    <select class="form-control device-type" name="typeTow" id="device-type-child"
                                            onchange="loadDeviceType(this,$('#device-type-child-child'))">
                                        <option value>无</option>
                                    </select>
                                </div>
                                <div class="col-4">
                                    <select class="form-control device-type" name="typeThree"
                                            id="device-type-child-child" onchange="selectData()">
                                        <option value>无</option>
                                    </select>
                                </div>
                            </div>
                            <span class="text-muted font-p12">于权限管理 - 设备类型管理中维护设备类型</span>
                        </div>

                        <div class="form-group col-4">
                            <label>设备图片</label>
                            <a class="image-upload-area text-center d-flex align-items-center justify-content-center"
                               href="##" onclick="$('#add_file_hide').click()">
                                <img id="img_load_area" src="../customize/images/icon/image-upload.png" alt="">
                            </a>
                            <input type="file" name="photoFile" id="add_file_hide" style="display: none">
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom02">设备位置<span class="form-required">*</span></label>
                            <input class="form-control mb-1" type="text" name="position" id="position_id"
                                   placeholder="例：113.629706,34.974877">
                            <a class="font-p14" href="https://lbs.amap.com/console/show/picker"
                               target="_blank">在地图上选择坐标</a>
                        </div>

                        <div class="form-group col-4">
                            <label for="validationCustom04">选择采集设备</label>
                            <select class="form-control" name="group" id="validationCustom04">
                                <option value="">请选择</option>
                            </select>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom05">站号</label>
                            <input class="form-control" type="text" name="port" id="validationCustom05">
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom06">维保周期<span class="form-required">*</span></label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="maintenanceCycle" id="validationCustom06">
                                <div class="input-group-append">
                                    <span class="input-group-text">天</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom07">峰值电价</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="maxPrice" id="validationCustom07"
                                       value="1.0697">
                                <div class="input-group-append">
                                    <span class="input-group-text">元/kWh</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom08">平值电价</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="avgPrice" id="validationCustom08"
                                       value="0.6418">
                                <div class="input-group-append">
                                    <span class="input-group-text">元/kWh</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group col-4">
                            <label for="validationCustom09">谷值电价</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="minPrice" id="validationCustom09"
                                       value="0.3139">
                                <div class="input-group-append">
                                    <span class="input-group-text">元/kWh</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-sub-title d-flex align-items-center mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>报警阈值设置</span>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="form-group col-4">
                            <label for="validationCustom11">电压峰值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="maxU" id="validationCustom11" value="380">
                                <div class="input-group-append">
                                    <span class="input-group-text">V</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom12">电流峰值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="maxI" id="validationCustom12" value="2.0">
                                <div class="input-group-append">
                                    <span class="input-group-text">A</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom13">电量峰值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="maxC" id="validationCustom13" value="100">
                                <div class="input-group-append">
                                    <span class="input-group-text">kWh</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom14">电压标准值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="standardU" id="validationCustom14"
                                       value="220">
                                <div class="input-group-append">
                                    <span class="input-group-text">V</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom15">电流标准值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="standardI" id="validationCustom15"
                                       value="1.5">
                                <div class="input-group-append">
                                    <span class="input-group-text">A</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-4">
                            <label for="validationCustom16">电量标准值</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="standardC" id="validationCustom16"
                                       value="50">
                                <div class="input-group-append">
                                    <span class="input-group-text">kWh</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="modal-sub-title d-flex align-items-end mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>标定信息</span>
                    <small class="text-secondary ml-2 font-p14">用电分析标准值配置</small>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="form-group col-4">
                            <label for="validationCustom21">额定功率</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="standardPower" id="validationCustom21"
                                       value="100">
                                <div class="input-group-append">
                                    <span class="input-group-text">kW</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-sub-title d-flex align-items-end mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>工作功率阈值设置</span>
                    <small class="text-secondary ml-2 font-p14">用于判断设备状态</small>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="form-group col-4">
                            <label for="validationCustom22">待机功耗</label>
                            <div class="input-group">
                                <input class="form-control" type="text" name="IAH" id="validationCustom22" value="0.5">
                                <div class="input-group-append">
                                    <span class="input-group-text">kW</span>
                                </div>
                            </div>
                        </div>
                        <!--                        <div class="form-group col-4">-->
                        <!--                            <label for="validationCustom22">待机功耗</label>-->
                        <!--                            <div class="input-group">-->
                        <!--                                <input class="form-control" type="text" name="IAH" id="validationCustom22" value="0.5">-->
                        <!--                                <div class="input-group-append">-->
                        <!--                                    <span class="input-group-text">kW</span>-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <!--                        <div class="form-group col-4">-->
                        <!--                            <label for="validationCustom23">待机电流</label>-->
                        <!--                            <div class="input-group">-->
                        <!--                                <input class="form-control" type="text" name="IAL" id="validationCustom23" value="0.2">-->
                        <!--                                <div class="input-group-append">-->
                        <!--                                    <span class="input-group-text">A</span>-->
                        <!--                                </div>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <div class="form-group col-4">
                            <label for="validationCustom24">电流比</label>
                            <input class="form-control" type="number" name="currentRatio" id="validationCustom24"
                                   value="1" min="1" max="9999">
                            <span class="text-muted font-p12">默认电流比1，可设置范围1-9999</span>
                        </div>
                        <div class="col-4">
                            <label>&nbsp;</label><br>
                            <button type="button" class="btn btn-info" onclick="check(1)">手动校验</button>
                            <label> </label>
                            <button type="button" class="btn btn-info" onclick="check(2)">自动校验</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="submit" class="btn btn-primary">提交保存</button>
            </div>
        </form>
    </div>
</div>

<div class="modal fade" id="viewInfoModal" data-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content text-body">
            <div class="modal-header">
                <div class="modal-title"><i class="iconfont icon-juxing"></i> 设备信息详情</div>
                <button type="button" class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
            </div>
            <div class="modal-body font-p14">
                <div class="modal-sub-title d-flex align-items-center mb-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>基本信息</span>
                </div>

                <div class="container">
                    <div class="row no-gutters">
                        <div class="col-2">设备名称</div>
                        <div class="col-2"><strong id="name-id"></strong></div>
                        <div class="col-2 text-break">设备编号</div>
                        <div class="col-2"><strong id="sn-id"></strong></div>
                        <div class="col-2">归属企业</div>
                        <div class="col-2"><strong id="ename-id"></strong></div>

                        <div class="col-2">采集设备编号</div>
                        <div class="col-2 text-break"><strong id="ceqNumber-id"></strong></div>
                        <div class="col-2">站号</div>
                        <div class="col-2"><strong id="port-id"></strong></div>
                        <div class="col-2">维保周期</div>
                        <div class="col-2"><strong id="maintenanceCycle-id"></strong></div>

                        <div class="col-2">峰值电价</div>
                        <div class="col-2"><strong id="maxPrice-id"></strong></div>
                        <div class="col-2">平值电价</div>
                        <div class="col-2"><strong id="avgPrice-id"></strong></div>
                        <div class="col-2">谷值电价</div>
                        <div class="col-2"><strong id="minPrice-id"></strong></div>

                        <div class="col-4 mb-1">设备图片</div>
                        <div class="col-4 mb-1">设备类型</div>
                        <div class="col-4 mb-1">添加时间</div>
                        <div class="col-4 mb-3">
                            <img class="img-fluid" src="../customize/images/device-img.png" style="max-height: 200px;"
                                 alt="" id="logo-id">
                        </div>
                        <div class="col-4 mb-3">
                            <strong id="deviceType">父级一/子级一/孙级一</strong>
                        </div>
                        <div class="col-4 mb-3">
                            <strong id="createTime-id"></strong>
                        </div>
                    </div>
                </div>

                <div class="modal-sub-title d-flex align-items-center mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>报警阈值设置</span>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="col-2">电压峰值</div>
                        <div class="col-2"><strong id="maxU-id"></strong></div>
                        <div class="col-2">电流峰值</div>
                        <div class="col-2"><strong id="maxI-id"></strong></div>
                        <div class="col-2">电量峰值</div>
                        <div class="col-2"><strong id="maxC-id"></strong></div>
                        <div class="col-2">电压标准值</div>
                        <div class="col-2"><strong id="standardU-id"></strong></div>
                        <div class="col-2">电流标准值</div>
                        <div class="col-2"><strong id="standardI-id"></strong></div>
                        <div class="col-2">电量标准值</div>
                        <div class="col-2"><strong id="standardC-id"></strong></div>
                    </div>
                </div>

                <div class="modal-sub-title d-flex align-items-end mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>标定信息</span>
                    <small class="text-secondary ml-2 font-p14">用电分析标准值配置</small>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="col-2">额定功率</div>
                        <div class="col-2"><strong id="standardPower-id"></strong></div>
                    </div>
                </div>
                <div class="modal-sub-title d-flex align-items-end mb-3 mt-3">
                    <i class="iconfont icon-juxing text-primary"></i><span>工作功率阈值设置</span>
                    <small class="text-secondary ml-2 font-p14">用于判断设备状态</small>
                </div>
                <div class="container">
                    <div class="row">
                        <div class="col-2">待机功耗</div>
                        <div class="col-2"><strong id="qddl"></strong></div>
                        <!--                        <div class="col-2">待机电流</div>-->
                        <!--                        <div class="col-2"><strong id="djdl"></strong></div>-->
                        <div class="col-2">电流比</div>
                        <div class="col-2"><strong id="dlb"></strong></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../plugins/jquery-3.4.1.min.js"></script>
<script src="../plugins/bootstrap/bootstrap.bundle.min.js"></script>
<script src="../plugins/bootstrapValidator/bootstrapValidator.min.js"></script>
<script src="../plugins/bootstrapValidator/zh_CN.js"></script>
<script src="../plugins/alert.js"></script>
<script src="../plugins/paging.js"></script>
<script src="../plugins/selectivity/selectivity-jquery.js"></script>
<script src="../customize/js/common.js"></script>
<script src="../customize/js/CommonUtils.js"></script>
<script src="../customize/js/customModalV2.js"></script>
<script src="../customize/js/prdEquManagement.js"></script>
<script>
    $("#page").paging({
        pageNo: 1,
        totalPage: 1,
        totalSize: 1,
        callback: function (num) {
        }
    });
    var whetherPermissionViewing = false;
    var whetherPermissionModify = false;

    // /* 鼠标悬浮展示二维码 */
    // // var timer;
    // $('.qr-code-wrapper').delegate('a', 'mouseenter', function () {
    //   // var $that = $(this);
    //   // clearTimeout(timer);
    //   // timer = setTimeout(function () {
    //   //   $that.siblings().slideDown();
    //   // }, 150);
    //   $(this).siblings().slideDown(0);
    // });
    // $('.qr-code-wrapper').delegate('a', 'mouseleave', function(){
    //   $(this).siblings().slideUp(0);
    // })
</script>
<shiro:hasPermission name="device:proc:view">
    <script>
        whetherPermissionViewing = true;
    </script>
</shiro:hasPermission>
<shiro:hasPermission name="device:proc:opera">
    <script>
        whetherPermissionModify = true;
    </script>
</shiro:hasPermission>
</html>